//
//  SortingTableViewCell.m
//  Ting
//
//  Created by 安静的美男子 on 14/11/15.
//  Copyright (c) 2014年 安静的美男子. All rights reserved.
//

#import "SortingTableViewCell.h"

@implementation SortingTableViewCell

- (void)awakeFromNib {
    // Initialization code
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.view = [[UIView alloc]initWithFrame:CGRectMake(20, 15, 280, 110)];
        [self.contentView addSubview:_view];
        self.title = [[UILabel alloc]initWithFrame:CGRectMake(30, 10, 180, 80)];
        self.title.numberOfLines = 0;
        
        [self.view addSubview:_title];
        
        self.view.layer.borderWidth = 1;
        self.view.layer.borderColor =[[UIColor orangeColor]CGColor];
        self.play = [[UIImageView alloc]initWithFrame:CGRectMake(5, 50, 30, 30)];
        self.play.image = [UIImage imageNamed:@"find_hotuser_play@2x.png"];
        
        [self.contentView addSubview:_play];
        self.photo = [[UIImageView alloc]initWithFrame:CGRectMake(235, 30, 60, 60)];
        [self.contentView addSubview:_photo];
        self.master = [[UILabel alloc]initWithFrame:CGRectMake(13, 88, 150, 15)];
        _master.font = [UIFont systemFontOfSize:13];
        
        [self.view addSubview:_master];
        self.date = [[UILabel alloc]initWithFrame:CGRectMake(120, 90, 50, 15)];
        _date.font = [UIFont systemFontOfSize:13];
        [self.contentView addSubview:_date];
        self.playCount = [[UIImageView alloc]initWithFrame:CGRectMake(35, 130, 15, 15)];
        self.playCount.image = [UIImage imageNamed:@"find_albumcell_play@2x.png"];
        
        [self.contentView addSubview:_playCount];
        self.playCountLB = [[UILabel alloc]initWithFrame:CGRectMake(50, 130, 30, 15)];
        _playCountLB.font = [UIFont systemFontOfSize:10];
        [self.contentView addSubview:_playCountLB];
        self.likeCount = [[UIImageView alloc]initWithFrame:CGRectMake(85, 130, 15, 15)];
        self.likeCount.image = [UIImage imageNamed:@"tab_card@2x.png"];
        [self.contentView addSubview:_likeCount];
        self.likeCountLB = [[UILabel alloc]initWithFrame:CGRectMake(100, 130, 20, 15)];
        
        _likeCountLB.font = [UIFont systemFontOfSize:10];
        [self.contentView addSubview:_likeCountLB];
        self.commentsCount =[[UIImageView alloc]initWithFrame:CGRectMake(130, 130, 15, 15)];
        self.commentsCount.image = [UIImage imageNamed:@"sound_comments@2x.png"];
        
        [self.contentView addSubview:_commentsCount];
        self.commentsCountLB = [[UILabel alloc]initWithFrame:CGRectMake(150, 130, 15, 15)];
        self.commentsCountLB.font = [UIFont systemFontOfSize:10];
        
        [self.contentView addSubview:_commentsCountLB];
        self.pubdate = [[UIImageView alloc]initWithFrame:CGRectMake(180, 130, 15, 15)];
        self.pubdate.image = [UIImage imageNamed:@"search_hist_tag@2x.png"];
        
        [self.contentView addSubview:_pubdate];
        self.pubdateLB = [[UILabel alloc]initWithFrame:CGRectMake(200, 130, 40, 15)];
        _pubdateLB.font = [UIFont systemFontOfSize:10];
        
        [self.contentView addSubview:_pubdateLB];
//        self.ZANView = [[UIView alloc]initWithFrame:CGRectMake(0, 155, 100, 35)];
////        _ZANView.backgroundColor = [UIColor lightGrayColor];
//        [self.contentView addSubview:_ZANView];
//        self.ZAN = [[UIImageView alloc]initWithFrame:CGRectMake(22, 0, 60, 35)];
//        _ZAN.image = [UIImage imageNamed:@"sound_op_fav_n@2x.png"];
//        [self.ZANView addSubview:_ZAN];
//        self.commentsView = [[UIView alloc]initWithFrame:CGRectMake(101, 155, 120, 35)];
////        _commentsView.backgroundColor = [UIColor lightGrayColor];
//        
//        [self.contentView addSubview:_commentsView];
//        self.comments = [[UIImageView alloc]initWithFrame:CGRectMake(29, 0, 61, 35)];
//        _comments.image = [UIImage imageNamed:@"sound_op_comment_n@2x.png"];
//        
//        [self.commentsView addSubview:_comments];
//        self.downloadView = [[UIView alloc]initWithFrame:CGRectMake(222, 155, 98, 35)];;
////        _downloadView.backgroundColor = [UIColor lightGrayColor];
//        [self.contentView addSubview:_downloadView];
//        self.download = [[UIImageView alloc]initWithFrame:CGRectMake(18, 0, 60, 35)];
//        _download.image = [UIImage imageNamed:@"sound_op_dowload_n@2x.png"];
//        [self.downloadView addSubview:_download];
        
    }
    return self;
    
}
-(void)setModel:(SortingModel *)model
{
    self.title.text = model.title;
    self.master.text = [NSString stringWithFormat:@"By%@",model.nickname];
    self.likeCountLB.text = [NSString stringWithFormat:@"%@",model.likes];
    self.commentsCountLB.text =[NSString stringWithFormat:@"%@",model.comments];
    self.playCountLB.text = [NSString stringWithFormat:@"%@",model.playtimes];
    
    float time =  [model.duration floatValue];
    time = time / 60.0;
    self.pubdateLB.text =[ NSString stringWithFormat:@"%.1fmin",time];
    [self.photo sd_setImageWithURL:[NSURL URLWithString:model.coverLarge] placeholderImage:[UIImage imageNamed:@"123.gif"]];
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
